package univer.oko.query.baseObjects;

import java.io.Serializable;

public abstract class DBObject implements Serializable, Comparable {
    protected DBObjectType type;
    protected String name = "";
    protected String textWithoutHeader = "";
    protected String text = "";


    public abstract String getTextWithoutHeader();

    public abstract void setTextWithoutHeader(String textWithoutHeader);

    public DBObjectType getType() {
        return type;
    }

    public void setType(DBObjectType type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public abstract String getText();


    public abstract void setText(String text);


    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        final DBObject dbObject = (DBObject) o;

        if (name != null ? !name.equalsIgnoreCase(dbObject.name) : dbObject.name != null) return false;
        if (type != dbObject.type) return false;

        return true;
    }

    public int hashCode() {
        int result;
        result = (type != null ? type.hashCode() : 0);
        result = 29 * result + (name != null ? name.hashCode() : 0);
        return result;
    }

    public int compareTo(Object o) {
        DBObject ob = (DBObject) o;
        return this.getName().compareTo(ob.getName());

    }

}
